
function initGuijiForRyd(){
	gpsTimeInit(1);
}

function rydQdButtonClick(){
	if($("#rydGjmc").val()==""){
		alert("请输入轨迹名称!");
		return;
	}
	top.gpsStartTime = $("#rydDwsj").val();
	top.gpsLineName =  $("#rydGjmc").val();
	top.rydKaishiDingweiQuding();
}


//////////二者的公用函数//////////////////////////////////////////
function checkTime(i)
{
	if (i<10) 
	  {i="0" + i}
	  return i
}

//初始化对话框，对时间进行操作
function gpsTimeInit(flag){
	var date = new Date();
	//对日期赋值
	var dateStr = date.getFullYear()+"年"+(date.getMonth()+1)+"月"+date.getDate()+"日"+date.getHours()+"时"+checkTime(date.getMinutes())+"分"+checkTime(date.getSeconds())+"秒";
	if(flag){
		$("#rydDwsj").attr("value",dateStr).attr("disabled","disabled");
	}else{
		$("#zhdnDwsj").attr("value",dateStr).attr("disabled","disabled");
	}
	t1 = setTimeout('gpsTimeInit('+flag+')',500);
}

///////////////////////////////灾害点的函数//////////////////////////////////////
function initGuijiForZhdn(){
	gpsTimeInit(0);
}

function zhdnQdButtonClick(){
	var zhdnTitle = $("#zhdnYjdcd").attr("title");
	var zhdbm = "";
	var zhdBiaoshi = "";
	if(zhdnTitle!=""||zhdnTitle!=null||zhdnTitle!=undefined){
		zhdbm = $("#zhdnYjdcdRes").val().split("&")[0];
		zhdBiaoshi = $("#zhdnYjdcdRes").val().split("&")[1];
	}else{
		alert("请选定灾害点!");
		return;
	}
	var zhdmc = $("#zhdnYjdcd").val();
	top.gpsStartTime = $("#zhdnDwsj").val();
	top.gpsLineName =  zhdbm+","+zhdmc+","+zhdBiaoshi;
	top.zhdKaishiDingweiQuding();
}


function getYJDCDForZhdnByKeyword(){
	var keyword = $("#zhdnYjdcd").val();
	var url = "getZhdByKeyword.shtml";
	var obj = {keyword:keyword};
	if(keyword!=""){
		$.post(url,obj,getYJDCDCallbackForZhdn);
	}
}


function getYJDCDCallbackForZhdn(res){
	if(res!=""){
		$("#zhdnYjdcdRes").html("");
		res = eval(res);
		var str1 = '<option value="" selected="selected">--请选择--</option>';
		$("#zhdnYjdcdRes").append(str1);
		for(var i = 0;i<res.length;i++){
			var str = "";
			var type = top.getOperTypeZhdByCode(res[i].biaoshi)
			str = "<option value='"+res[i].id+"&"+res[i].biaoshi+"'>"+res[i].name+"("+type+")"+"</option>";
			$("#zhdnYjdcdRes").append(str);
		}
		$("#zhdnYjdcdRes").change(function(){
			$("#zhdnYjdcd").attr("value",res[$("#zhdnYjdcdRes").attr("selectedIndex")-1].name).attr("title",$("#zhdnYjdcdRes").val());
		});
	}
}